package com.cn.utils;

import java.io.UnsupportedEncodingException;

public class CharacterEncoding {
    public CharacterEncoding() {
    }

    /**
     * 对字符串进行转码处理
     * @param str 要转码的字符串
     * @return 编码后的字符串
     */
    public String toString(String str) {
        String text="";
        if (str != null && !str.isEmpty()) {
            try {
                text=new String(str.getBytes("iso-8859-1"),"utf-8");
            }catch (UnsupportedEncodingException e){}
        }
        return text;
    }
}
